<form action="/admini/system/statuslist"  method="post" style="margin:0px" id="form1">
    <div style=" border:1px solid #DDDDDD; padding:2px; margin:2px;line-height: 36px;" id='sel'> 
        <label for="quick">快速搜索：</label><input type="text" id="quick" name="name" value="<?php echo $this->name;?>"/>
        <input type="submit" id="queryButton" name="queryButton" value="查询"/>
    </div>
</form>
<div class="dataTable">
    <table>         
    <tfoot>
      <tr><td colspan="14"><input class="button" id="add-button" type="button" value="添加"/></td>
      </tr>
    </tfoot>
        <tr>
            <th class="w1" width="5px">&nbsp;</th>
            <th class="w2" width="4%" nowrap>ID</th>
            <th class="w3" width="18%" nowrap>状态名称</th>
            <th class="w4" width="14%" nowrap>状态值</th>
            <th class="w5" width="26%" nowrap>状态所属类型</th>
            <th class="w6" width="38%" nowrap>描述</th>
            <th class="w12"></th>
        </tr>
        <?php
        if ($this->statuslist) {
            foreach ($this->statuslist as $Item) {    
         ?>
            <tr>
                <td class="w1" width="5px">&nbsp</td>
                <td class="w2"><?php echo $Item->id; ?></td>
                <td class="w3"><a href="javascript:void(0)" id="edit-a" name="<?php echo $Item->id; ?>" class="indexa"><?php echo $Item->name; ?></a></td>
                <td class="w4"><?php echo $Item->statusValue;?></td>
                <td class="w5"><?php echo $Item->statusType;?></td>
                <td class="w6"><?php echo $Item->remark;?></td>
                <td class="w12"></td>
            </tr>
        <?php
            }
        }
        ?>
    </table>
</div>                
<div class="toolbar">   
    <?php //echo $this->partial('paging.phtml', array("pages" => $this->userall,"pamas"=>"username=".$this->nikename."&email=$this->email&storeno=$this->storeno&dateselect=$this->dateselect&starttime=$this->starttime&endtime=$this->endtime")); ?>
    <?php echo $this->partial('paging.phtml', array("pages" => $this->statusall,"pamas"=>"name=".$this->name."&dateselect=$this->dateselect&starttime=$this->starttime&endtime=$this->endtime")); ?>
</div>

<div class="tanchuang" style="display:none;" id="add_status">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="edithead" style="display:none;">更新状态</div>
        <div class="nui-msgbox-hd" id="addhead" style="display:none;">添加状态</div>
        <a class="nui-msgbox-close" title="关闭" id="exitissue"><b></b></a>
    </div>
    <div class="neirbox">
        <form method="post" action="/admini/system/statusprocess" id="formissue">
	<table>
            <tr>
            	<td class="askl">状态名称：</td>
                <td><input type="text" name="name" id="name" class="input w400" value=""/></td>
            </tr>
            <tr>
            	<td class="askl">状态值：</td>
                <td><input type="text" name="statusValue" id="statusValue" class="input w400" value=""></td>
            </tr>
            <tr>
            	<td class="askl">状态所属类型：</td>
                <td><input type="text" name="statusType" id="statusType" class="input w400" value=""/></td>
            </tr>
            <tr>
                <td class="askl">描述：</td>
                <td><textarea name="remark" id="remark" cols="60" rows="8"></textarea></td>
            </tr>
        </table>
        <div class="neirboxok">
            <input type="hidden" id="id" name="statusid" value="" />
            <a class="anvbotton" href="javascript:void(0)" id="subissue"><span>确认提交</span></a>
        </div>  
        </form>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>


<script type="text/javascript" language="javascript">
    $('#add-button').click(function(){
        $(".neirbox #name").val("");
        $(".neirbox #statusValue").val("");
        $(".neirbox #statusType").val("");
        $(".neirbox input#id").val("");
        $(".neirbox #remark").val("");
        $('#add_status').attr("style","display:block");
        $('#addhead').attr("style","display:block");
        $("#edithead").attr("style","display:none;");
        $("div.houtai_overlay").attr("style","display:block;");
    });
    $('#exitissue').click(function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $('#add_status').attr("style","display:none;");
    })
    $("#subissue").live("click",function(){
       var name = $(".neirbox #name").val(); 
       var statusValue = $(".neirbox #statusValue").val(); 
       var statusType = $(".neirbox #statusType").val();
       var remark = $(".neirbox #remark").val();
       if(statusValue != ""){
           if(isNaN(statusValue)){
                alert("状态值为数字");
                return false;
           }
       }
       if(name == ""){
           alert("状态名称不能为空！");
           return false;
       }else if(statusValue == ""){
           alert("状态值不能为空！");
           return false;
       }else if(statusType == ""){
           alert("状态类型不能为空！");
           return false;
       }else if(remark == ""){
           alert("描述不能为空！");
           return false;
       }else{
           $("#formissue").submit();
       }
    });
    
    $('#edit-a').live("click",function(){
        var id = $(this).attr("name");
       $.ajax({
            type: 'POST',
            url: "/admini/system/editstatus?id="+id,
            success: function(data) {
                if(data.type == 1){
                    $(".neirbox #name").val(data.name);
                    $(".neirbox #statusValue").val(data.statusValue);
                    $(".neirbox #statusType").val(data.statusType);
                    $(".neirbox #remark").val(data.remark);
                    $(".neirbox input#id").val(id);
                    $('#add_status').attr("style","display:block");
                    $("div#edithead").attr("style","display:block;");
                    $("div#addhead").attr("style","display:none;");
                    $("div.houtai_overlay").attr("style","display:block;");
                }else{
                    alert("发生未知错误！");
                }
           }
       });
    })
</script>